package com.orchard.xpz.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.DelegatingFilterProxy;
//import org.springframework.security.web.firewall.HttpFirewall;
/**
 * @TaskCode:
 * @description:
 * @author: minshuai.chen
 * @create: 2022/4/21 10:11
 **/
@Configuration
public class MyFilterConfig {

    @Bean
    public AuthFilter replyHeaderFilter()
    {
        return new AuthFilter();
    }

    @Bean
    public FilterRegistrationBean filterRegistrationBean(){
        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
        registrationBean.setFilter(new DelegatingFilterProxy("replyHeaderFilter"));
        registrationBean.setName("replyHeaderFilter");
        return registrationBean;
    }

    //允许多请求地址多加斜杠  比如 /msg/list   //msg/list
//    @Bean
//    public HttpFirewall httpFirewall() {
//        return new DefaultHttpFirewall();
//    }
}
